<template>
  <div class="container">

    <Row class="btn-action">
      <Col span="24">
        <Button type="primary" class="mp10" :loading="loading" href="fcAllDataStr" @click="exportData(1)"><Icon type="ios-download-outline"></Icon>导出数据</Button>
      </Col>
    </Row>

    <div class="opt-area-02">
      <div class="left-con">
        录入总数: <span>{{countData.fcnum}} 条</span>
      </div>
      <div class="right-con">
        <!--                <div class="input-frame">-->
        <!--                    <Select v-model="params.hot" placeholder="发热状态" @on-change="selectlist">-->
        <!--                        <Option value="">全部</Option>-->
        <!--                        <Option value="0">未发热</Option>-->
        <!--                        <Option value="1">发热</Option>-->
        <!--                    </Select>-->
        <!--                </div>-->
        <div class="input-frame">
          <Input type="text" @on-click="selectlist(1)" placeholder="请输入姓名" v-model="params.name"
                 icon="ios-search"/>
        </div>
        <div class="input-frame">
          <Input type="text" @on-click="selectlist(1)" placeholder="请输入身份证号" v-model="params.card_no"
                 icon="ios-search"/>
        </div>
        <div class="input-frame">
          <Input type="text" @on-click="selectlist(1)" placeholder="请输入联系方式" v-model="params.tel"
                 icon="ios-search"/>
        </div>
        <div class="input-frame">
          <Select v-model="params.area1" placeholder="区/县" filterable @on-change="perChange(1)">
            <Option v-for="obj in addressInfo.list1" :value="obj.company_code" :key="obj.id">{{obj.title}}</Option>
          </Select>
        </div>
        <div class="input-frame">
          <Select v-model="params.area2" placeholder="街道" filterable @on-change="perChange(2)">
            <Option v-for="obj in addressInfo.list2" :value="obj.company_code" :key="obj.id">{{obj.title}}</Option>
          </Select>
        </div>
        <div class="input-frame">
          <Select v-model="params.area3" placeholder="社区" filterable>
            <Option v-for="obj in addressInfo.list3" :value="obj.company_code" :key="obj.id">{{obj.title}}</Option>
          </Select>
        </div>
        <Button type="info" size="small" @click="selectlist(1)" style="margin-top: 5px">搜索</Button>
      </div>
      <div class="right-con">
        <div class="input-frame" style="width: 164px">
          <DatePicker type="datetimerange" v-model="dateArr" placeholder="选择录入时间起止" style="width: 164px"></DatePicker>
        </div>
        <div class="input-frame" style="width: 164px">
          <Select v-model="params.arrive_address_type" placeholder="来沈前经过地" filterable>
            <Option v-for="obj in dictList" :value="obj.value" :key="obj.id">{{obj.label}}</Option>
          </Select>
        </div>
        <!-- <div class="input-frame" style="width: 164px">
          <Select v-model="params.isfollow" placeholder="密切接触人群" @on-change="selectlist" style="width: 164px">
            <Option value="">全部</Option>
            <Option value="0">否</Option>
            <Option value="1">是</Option>
          </Select>
        </div> -->
        <!-- <div class="input-frame" style="width: 164px">
          <Select v-model="params.illness_state" placeholder="人员状态" @on-change="selectlist" style="width: 164px">
            <Option value="">全部</Option>
            <Option value="1">疑似病例</Option>
            <Option value="2">确诊病例</Option>
            <Option value="3">死亡</Option>
            <Option value="4">治愈</Option>
            <Option value="5">正常</Option>
          </Select>
        </div> -->
        <!-- <div class="input-frame" style="width: 164px">
          <Select v-model="params.inout_state" placeholder="离沈/入沈" @on-change="selectlist" style="width: 164px">
            <Option value="">全部</Option>
            <Option value="1">入沈人员</Option>
            <Option value="2">离沈人员</Option>
          </Select>
        </div> -->
        <div class="input-frame" style="width: 164px">
          <Select v-model="params.supervise_start" placeholder="管控状态" filterable>
            <Option v-for="obj in superviseDictList" :value="obj.value" :key="obj.id">{{obj.label}}</Option>
          </Select>
        </div>
        <div class="input-frame" style="width: 164px">
          <Select v-model="params.user_type" placeholder="数据来源" @on-change="selectlist" style="width: 164px">
            <Option value="">全部</Option>
            <Option value="1">社区</Option>
            <Option value="2">农村</Option>
          </Select>
        </div>
      </div>
      <div class="right-con">
<!--        <div class="input-frame" style="width: 164px">-->
<!--          <Select v-model="params.province2" placeholder="来沈前出发地省" filterable @on-change="chaneProv(2)" style="width: 164px">-->
<!--            <Option v-for="obj in inoutCity.provinceList" :value="obj.name" :key="obj.code">{{obj.name}}</Option>-->
<!--          </Select>-->
<!--        </div>-->
<!--        <div class="input-frame" style="width: 164px">-->
<!--          <Select v-model="params.city2" placeholder="来沈前出发地市" filterable style="width: 164px">-->
<!--            <Option v-for="obj in inoutCity.city2" :value="obj.name" :key="obj.code">{{obj.name}}</Option>-->
<!--          </Select>-->
<!--        </div>-->
        <div class="input-frame" style="width: 164px">
          <DatePicker type="datetimerange" v-model="arriveDateArr" placeholder="选择来沈时间起止" style="width: 164px"></DatePicker>
        </div>
        <!-- <div class="input-frame" style="width: 164px">
          <Select v-model="params.state" placeholder="隔离状态" @on-change="selectlist" style="width: 164px">
            <Option value="">全部</Option>
            <Option value="1">在家留观</Option>
            <Option value="2">集中留观</Option>
          </Select>
        </div> -->
        <div class="input-frame" style="width: 164px">
          <Input type="text" @on-click="selectlist(1)" placeholder="请输入id" v-model="params.id"
                 icon="ios-search"/>
        </div>
        <div class="input-frame" style="width: 164px">
          <Select v-model="params.nucleic_acid" placeholder="核酸检测" @on-change="selectlist" style="width: 164px">
            <Option value="">全部</Option>
            <Option value="0">未检测</Option>
            <Option value="1">已检测</Option>
          </Select>
        </div>
        <div class="input-frame" style="width: 164px">
          <Select v-model="params.card_type" placeholder="证件类型" @on-change="selectlist" style="width: 164px">
            <Option value="">全部</Option>
            <Option value="1">身份证</Option>
            <Option value="2">军官证</Option>
            <Option value="3">护照</Option>
            <Option value="4">港澳通行证</Option>
          </Select>
        </div>
      </div>
    </div>
    <Table :loading="countData.loading" border :columns="columns2" :data="fcDataList" size="small" ref="table">
      <template slot-scope="{ row }" slot="nucleic_acid">
        <span v-if="row.nucleic_acid == '0'">未检测</span>
        <span v-if="row.nucleic_acid == '1'">已检测</span>
      </template>
      <template slot-scope="{ row }" slot="illness_state">
        <span v-if="row.illness_state == '1'" style="color: red">疑似病例</span>
        <span v-if="row.illness_state == '2'" style="color: red">确诊病例</span>
        <span v-if="row.illness_state == '3'" style="color: red">死亡</span>
        <span v-if="row.illness_state == '4'" >治愈</span>
        <span v-if="row.illness_state == '5'" >正常</span>
      </template>
      <template slot-scope="{ row }" slot="inout_state">
        <span v-if="row.inout_state == '1'">来沈人员</span>
        <span v-if="row.inout_state == '2'">离沈人员</span>
      </template>
      <!--            <template slot-scope="{ row }" slot="hot">-->
      <!--              <span v-if="row.hot == '1'" style="color: red">发热</span>-->
      <!--              <span v-else>未发热</span>-->
      <!--            </template>-->
      <template slot-scope="{ row }" slot="referral">
        <span v-if="row.referral == '1'">已送诊</span>
        <span v-else style="color: red">未送诊</span>
      </template>
      <template slot-scope="{ row }" slot="state">
        <span v-if="row.state == '1'">在家留观</span>
        <span v-if="row.state == '2'">集中留观</span>
      </template>
      <template slot-scope="{ row }" slot="isfollow">
        <span v-if="row.isfollow == '1'" style="color: red">是</span>
        <span v-else>否</span>
      </template>
      <template slot-scope="{ row }" slot="arrive_address_type">
        <span v-if="row.arrive_address_type == '6'" style="color: red">韩国</span>
        <span v-if="row.arrive_address_type == '7'" style="color: red">日本</span>
      </template>
      <template slot="action" slot-scope="{ row }">
        <Row style="margin-bottom: 5px; margin-top: 2px">
          <Button class="table-action-btn" type="info" size="small" @click="showdetail(row, 'info')">详情</Button>
        </Row>
      </template>
    </Table>
    <Row v-if="loadData == true">
      <Col class="demo-spin-col" span="8" offset="8">
        <Spin fix>
          <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
          <div>Loading</div>
        </Spin>
      </Col>
    </Row>
    <Row type="flex" justify="end" class="page_style">
      <Page :current="params.pageNo" :total="params.totalRecord" show-sizer :page-size="params.pageSize"
            show-total @on-change="pageAction" @on-page-size-change="pageSizeChange"/>
    </Row>
    <Modal v-model="modal1" title="发热情况" @on-ok="ok" @on-cancel="cancel">
      <RadioGroup v-model="hot">
        <Radio label="0">未发热</Radio>
        <Radio label="1">发热</Radio>
      </RadioGroup>
    </Modal>
    <Modal v-model="modal2" title="送诊情况" @on-ok="ok1" @on-cancel="cancel">
      <Row class="mb20">
        <RadioGroup v-model="referral">
          <Radio label="0">未送诊</Radio>
          <Radio label="1">送诊</Radio>
        </RadioGroup>
      </Row>
      <Row v-if="referral == '1'">
        <Input v-model="referral_address" placeholder="送诊地址" type="textarea" style="width: 300px"></Input>
      </Row>
    </Modal>
    <Modal v-model="modal4" title="离沈情况" @on-ok="ok2" @on-cancel="cancel">
      <Row class="mb20">
        <RadioGroup v-model="modalInfo1.isout_sheny">
          <Radio label="0">未离沈</Radio>
          <Radio label="1">离沈</Radio>
        </RadioGroup>
      </Row>
      <Row v-if="modalInfo1.isout_sheny == '1'">
        <Input v-model="modalInfo1.isout_sheny_remark" placeholder="离沈后轨迹" type="textarea" style="width: 300px"></Input>
      </Row>
    </Modal>
    <Modal v-model="modal3" title="选择迁出到社区" @on-ok="saveCompany()" @on-cancel="cancel">
      <Form label-position="right" :label-width="100">
        <Row>
          <Col span="5" class="ivu-form-item-label">迁入社区：</Col>
          <Col span="16" class="ivu-form-item-content">
            <Select v-model="modalStr" filterable>
              <Option v-for="company in company_list" :value="JSON.stringify(company)"
                      v-bind:key="company.key">{{company.sq_name }} {{company.name}}（{{company.code}}）</Option>
            </Select>
          </Col>
        </Row>
      </Form>
    </Modal>
  </div>
</template>

<script>
import { userOutCountryUpList, updateuserinfo, delbyid, createOutApplu, date0str, userOutCountryToExcelUpList, getDictList } from '@/api/yi-qing-fang-kong'
import { grid_downlist, getUserByMZList } from '@/api/eventlist'
import { getCityList } from '@/api/common'
export default {
  name: 'foreign-person-list',
  data () {
    return {
      dictList: [],
      superviseDictList: [],
      dataFlag: false,
      dateArr: [],
      arriveDateArr: [],
      loadData: true,
      fcAllDataStr: '',
      modalInfo1: {
        isout_sheny: '',
        isout_sheny_remark: '',
        id: this.id
      },
      modal4: false,
      loading: false,
      fcAllDataList: [],
      modalStr: '',
      modalInfo: {
        in_company: '',
        user_id: '',
        out_company_name: '',
        in_company_name: ''
      },
      type: this.$route.query.type, // 列表类型
      addressInfo: { list1: [], list2: [], list3: [] },
      inoutCity: { provinceList: [], city1: [], city2: [] },
      company_list: [],
      id: '',
      hot: '',
      referral: '',
      referral_address: '',
      modal1: false,
      modal2: false,
      modal3: false,
      row: {},
      countData: { loading: false, fcnum: 0, ytbnum: 0, zcnum: 0 },
      params: { name: '', type: '', pageNo: 1, pageSize: 10, totalRecord: 0, state: '', area1: '', area2: '', area3: '', arrive_address_type: '15', hot: '', isfollow: '', user_type: '', starttime: '', endtime: '', company_code: '', isout_sheny: '', originate_province: '', originate_city: '', arrivestarttime: '', arriveendtime: '', id: '', nucleic_acid: '', card_type: '' },
      columns2: [
        { title: 'ID', key: 'id', width: 150, align: 'center' },
        { title: '姓名', key: 'NAME', width: 100, align: 'center' },
        { title: '联系方式', key: 'tel', width: 120, align: 'center' },
        { title: '身份证号', key: 'card_no1', width: 160, align: 'center' },
        { title: '性别', key: 'sex', width: 80, align: 'center' },
        { title: '核酸检测', slot: 'nucleic_acid', width: 100, align: 'center' },
        // { title: '人员状态', slot: 'illness_state', width: 100, align: 'center' },
        // { title: '离沈状态', slot: 'inout_state', width: 100, align: 'center' },
        { title: '管控状态', key: 'supervise_start1', width: 100, align: 'center' },
        // { title: '发热状态', slot: 'hot', width: 100, align: 'center' },
        // { title: '送诊状态', slot: 'referral', width: 100, align: 'center' },
        // { title: '隔离状态', slot: 'state', width: 100, align: 'center' },
        // { title: '密切接触人群(是/否)', slot: 'isfollow', width: 100, align: 'center' },
        // { title: '剩余安全观察期日期', key: 'safe_date', width: 150, align: 'center' },
        { title: '来沈前经过地', slot: 'arrive_address_type', width: 120, align: 'center' },
        { title: '来沈前出发地', key: 'originate_province', width: 130, align: 'center' },
        // { title: '来沈前出发地市', key: 'originate_city', width: 130, align: 'center' },
        { title: '区、县(市)', key: 'area', width: 80, align: 'center' },
        { title: '街道(乡镇)', key: 'street', width: 80, align: 'center' },
        { title: '社区(村)', key: 'community', width: 100, align: 'center' },
        { title: '录入社区', key: 'company_name', width: 100, align: 'center' },
        { title: '录入时间', key: 'create_time', width: 200, align: 'center' },
        { title: '来沈时间', key: 'arrive_time', width: 200, align: 'center' },
        { title: '具体地址', key: 'address1', minWidth: 250, align: 'center' },
        { title: '操作', align: 'center', width: 80, slot: 'action', fixed: 'right' }
      ],
      columns1: [
        { title: 'id', key: 'id', width: 100, align: 'center' },
        { title: '姓名', key: 'NAME', width: 100, align: 'center' },
        { title: '证件类型', key: 'card_type', width: 100, align: 'center' },
        { title: '证件号码', key: 'card_no', width: 160, align: 'center' },
        { title: '性别', key: 'sex', width: 80, align: 'center' },
        { title: '核酸检测', key: 'nucleic_acid', width: 80, align: 'center' },
        { title: '人员状态', key: 'illness_state', width: 100, align: 'center' },
        { title: '离沈状态', key: 'inout_state', width: 100, align: 'center' },
        // { title: '发热状态', slot: 'hot', width: 100, align: 'center' },
        // { title: '送诊状态', key: 'referral', width: 100, align: 'center' },
        { title: '隔离状态', key: 'state', width: 100, align: 'center' },
        // { title: '密切接触人群(是/否)', key: 'isfollow', width: 100, align: 'center' },
        // { title: '剩余安全观察期日期', key: 'safe_date', width: 150, align: 'center' },
        { title: '来沈前经过地', key: 'arrive_address_type', width: 120, align: 'center' },
        { title: '来沈前出发地', key: 'originate_province', width: 130, align: 'center' },
        // { title: '来沈前出发地市', key: 'originate_city', width: 130, align: 'center' },
        { title: '区、县(市)', key: 'area', width: 80, align: 'center' },
        { title: '街道(乡镇)', key: 'street', width: 80, align: 'center' },
        { title: '社区(村)', key: 'community', width: 100, align: 'center' },
        { title: '录入社区', key: 'company_name', width: 100, align: 'center' },
        { title: '录入时间', key: 'create_time', width: 200, align: 'center' },
        { title: '联系方式', key: 'tel', width: 120, align: 'center' },
        { title: '来沈时间', key: 'arrive_time', width: 200, align: 'center' },
        { title: '具体地址', key: 'address', minWidth: 250, align: 'center' }
        // { title: '是否删除', key: 'del_flag', minWidth: 100, align: 'center' }
      ],
      fcDataList: []
    }
  },
  computed: {
    companyCode () {
      return this.$store.state.user.severUserInfo.company_code
    }
  },
  watch: {
    $route: function (to, from) {
      console.log(this.$route.query.type, to, '!@!@#@')
      this.type = to.query.type
      this.params.user_type = to.query.user_type
      console.log(this.params, '入参')
      this.selectlist()
    }
  },
  methods: {
    pageAction (page) {
      this.params.pageNo = page
      this.getList()
    },
    selectlist () {
      console.log(this.dateArr)
      this.params.starttime = date0str(this.dateArr[0])
      this.params.endtime = date0str(this.dateArr[1])
      this.params.arrivestarttime = date0str(this.arriveDateArr[0])
      this.params.arriveendtime = date0str(this.arriveDateArr[1])
      this.params.pageNo = 1
      this.params.type = this.type
      if (this.params.area3 === '' && this.params.area2 === '') {
        this.params.company_code = this.params.area1
      } else if (this.params.area2 !== '' && this.params.area3 === '') {
        this.params.company_code = this.params.area2
      } else if (this.params.area1 === '' && this.params.area2 === '' && this.params.area3 === '') {
        this.params.company_code = ''
      } else if (this.params.area1 !== '' && this.params.area2 !== '' && this.params.area3 !== '') {
        this.params.company_code = this.params.area3
      }
      this.params.originate_province = this.params.province2
      this.params.originate_city = this.params.city2
      this.getList()
    },
    getList () {
      // ---调用接口可以打开
      userOutCountryUpList(this.params).then(res => {
        let result = res.data
        let that = this
        if (res.data.errcode === 0 || res.data.errcode === 1001) {
          this.fcDataList = res.data.data.results
          this.fcDataList.forEach(function (temp1, index) {
            for (var i = 0; i < that.dictList.length; i++) {
              if (temp1.arrive_address_type === that.dictList[i].value) {
                temp1.arrive_address_type1 = that.dictList[i].label
              }
            }
            for (var j = 0; j < that.superviseDictList.length; j++) {
              if (temp1.supervise_start === that.superviseDictList[j].value) {
                temp1.supervise_start1 = that.superviseDictList[j].label
              }
            }
            let tempCardno = temp1.card_no
            if (tempCardno) {
              temp1.card_no1 = `${tempCardno.substring(0, 10)}******${tempCardno.substring(tempCardno.length - 2)}`
            }
            // let tempMobile = temp1.tel
            // if (tempMobile) {
            //  if (tempMobile.length === 11) {
            //    temp1.tel1 = `${tempMobile.substring(0, 3)}****${tempMobile.substring(tempMobile.length - 4)}`
            //  } else {
            //    temp1.tel1 = `${tempMobile.substring(0, 3)}****`
            //  }
            // }
            let tempAddress = temp1.address
            if (tempAddress) {
              temp1.address1 = that.hideCode(tempAddress, 4, 2)
            }
            let tempBirthday = temp1.birthday
            if (tempBirthday) {
              this.datalist[i].birthday = `${tempBirthday.substring(0, 4)}****`
            }
          })
          this.loadData = false
          this.countData.fcnum = res.data.data.totalRecord
          this.params = {
            pageNo: result.data.pageNo,
            pageSize: result.data.pageSize,
            totalPage: result.data.totalPage,
            totalRecord: result.data.totalRecord,
            // area: this.params.area,
            street: this.params.street,
            community: this.params.community,
            area1: this.params.area1,
            area2: this.params.area2,
            area3: this.params.area3,
            card_no: this.params.card_no,
            name: this.params.name,
            tel: this.params.tel,
            arrive_address_type: this.params.arrive_address_type,
            hot: this.params.hot,
            isfollow: this.params.isfollow,
            illness_state: this.params.illness_state,
            isout_sheny: this.params.isout_sheny,
            user_type: this.params.user_type,
            endtime: this.params.endtime,
            starttime: this.params.starttime,
            originate_province: this.params.originate_province,
            originate_city: this.params.originate_city,
            province2: this.params.province2,
            city2: this.params.city2,
            company_code: this.params.company_code,
            // inout_state: this.params.inout_state,
            supervise_start: this.params.supervise_start,
            arrivestarttime: this.params.arrivestarttime,
            arriveendtime: this.params.arriveendtime,
            state: this.params.state,
            id: this.params.id,
            nucleic_acid: this.params.nucleic_acid,
            card_type: this.params.card_type
          }
        } else {
          this.loadData = true
          this.$Notice.error({
            title: '查询列表信息失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    getAllList () {
      let that = this
      this.params.pageNo = 1
      this.params.pageSize = 50000
      userOutCountryToExcelUpList(this.params).then(res => {
        if (res.data.errcode === 0) {
          this.loading = false
          this.fcAllDataList = res.data.data
          this.dataFlag = true
          this.$refs.table.exportCsv({
            filename: '外籍人员信息',
            columns: this.columns1,
            data: this.fcAllDataList.map(item => {
              item.arrive_time = '="' + item.arrive_time + '"'
              item.create_time = '="' + item.create_time + '"'
              // if (item.referral === '1') { // 送诊状态
              //   item.referral = '已送诊'
              // } else {
              //   item.referral = '未送诊'
              // }
              if (item.illness_state === '1') { // 人员状态
                item.illness_state = '疑似病例'
              } else if (item.illness_state === '2') {
                item.illness_state = '确诊病例'
              } else if (item.illness_state === '3') {
                item.illness_state = '死亡'
              } else if (item.illness_state === '4') {
                item.illness_state = '治愈'
              } else if (item.illness_state === '5') {
                item.illness_state = '正常'
              }
              if (item.isfollow === '1') { // 密切接触
                item.isfollow = '是'
              } else {
                item.isfollow = '否'
              }
              // if (item.inout_state === '1') { // 离沈入沈
              //  item.inout_state = '入沈人员'
              // } else if (item.inout_state === '2') {
              //  item.inout_state = '离沈人员'
              // }
              // if (item.arrive_address_type === '6') {
              //  item.arrive_address_type = '韩国'
              // } else if (item.arrive_address_type === '7') {
              //  item.arrive_address_type = '日本'
              // }
              for (var i = 0; i < that.dictList.length; i++) {
                if (item.arrive_address_type === that.dictList[i].value) {
                  item.arrive_address_type = that.dictList[i].label
                }
              }
              // if (item.del_flag === '1') {
              //  item.del_flag = '否'
              // } else if (item.del_flag === '0') {
              //  item.del_flag = '是'
              // }
              return item
            }),
            original: false
          })
          console.log('123123')
        } else {
          this.dataFlag = false
          this.$Notice.error({
            title: '查询全部人员信息列表失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    findDictList (value) {
      let that = this
      var dicObj = { 'label': '全部', 'value': '' }
      getDictList({ type: 'arrive_address_type' }).then(res => {
        if (res.data.errcode === 0) {
          var array = res.data.data.results
          for (var i = 0; i < array.length; i++) {
            if (array[i].value === '15') {
              this.dictList.push(array[i])
            }
          }
          setTimeout(function () {
            that.selectlist()
          }, 500)
        } else {
          this.$Notice.error({ title: '查询失败' })
        }
      })
      getDictList({ type: 'supervise_start' }).then(res => {
        if (res.data.errcode === 0) {
          this.superviseDictList = res.data.data.results
          this.superviseDictList.unshift(dicObj)
          setTimeout(function () {
            that.selectlist()
          }, 500)
        } else {
          this.$Notice.error({ title: '查询失败' })
        }
      })
    },
    chaneProv (index) {
      let temparea = this.params['province' + index]
      if (!temparea) {
        return
      }
      let templist = this.inoutCity.provinceList
      let tempdata = {}
      for (let i = 0; i < templist.length; i++) {
        if (temparea === templist[i].name) {
          tempdata = templist[i]
          break
        }
      }
      this.getCity(tempdata.code, 'city' + index, false)
    },
    getCity (code, listname, flag) {
      getCityList({ code: code }).then(res => {
        if (res.data.errcode === 0) {
          this.inoutCity[listname] = res.data.data
          if (flag) {
            if (this.formInfo.province1) {
              this.chaneProv(1)
            }
            if (this.formInfo.province2) {
              this.chaneProv(2)
            }
          }
        } else {
          this.$Notice.error({ title: '查询失败' })
        }
      })
    },
    deleteRow (row) {
      this.$Modal.confirm({
        title: '确认删除该人员信息吗？',
        content: '删除后不可恢复，请确认后再操作！',
        onOk: () => {
          delbyid({ id: row.id }).then(res => {
            if (res.data.errcode === 0) {
              this.getList()
            } else {
              this.$Notice.error({
                title: '删除人员信息失败',
                desc: res.data.errmsg
              })
            }
          })
        }
      })
    },
    moveOut (row) {
      this.modal3 = true
      this.id = row.id
    },
    addPerson (what) {
      this.$router.push({ path: '/yi-qing/add-buttons' })
    },
    census () {
      this.$router.push({ path: '/yi-qing/statistics' })
    },
    showdetail (row, what) {
      this.$router.push({
        path: '/yi-qing/add',
        query: {
          id: row.id,
          what: what,
          arrive_address_type: row.arrive_address_type,
          user_type: this.params.user_type
        }
      })
    },
    temperature (row) {
      this.$router.push({ path: '/yi-qing/fever-list', query: { id: row.id } })
    },
    fever (row) {
      this.modal1 = true
      this.hot = row.hot
      this.id = row.id
    },
    Referral (row) {
      this.modal2 = true
      this.referral = row.referral
      this.referral_address = row.referral_address
      this.id = row.id
    },
    leave (row) {
      this.modal4 = true
      this.modalInfo1.id = row.id
      this.modalInfo1.isout_sheny = row.isout_sheny
      this.modalInfo1.isout_sheny_remark = row.isout_sheny_remark
    },
    ok1 () {
      updateuserinfo({ id: this.id, referral: this.referral, referral_address: this.referral_address }).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '',
            desc: '更改送诊信息成功'
          })
          this.modal1 = false
          this.getList()
        } else {
          this.$Notice.error({
            title: '更改送诊状态失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    ok2 () {
      updateuserinfo(this.modalInfo1).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '',
            desc: '更改离沈信息成功'
          })
          this.modal4 = false
          this.getList()
        } else {
          this.$Notice.error({
            title: '更改离沈状态失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    ok () {
      updateuserinfo({ id: this.id, hot: this.hot }).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '',
            desc: '更改发热状态成功'
          })
          this.modal1 = false
          this.getList()
        } else {
          this.$Notice.error({
            title: '更改发热状态失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    saveCompany () {
      console.log(JSON.parse(this.modalStr))
      this.modalInfo = {
        user_id: this.id,
        in_company: JSON.parse(this.modalStr).code,
        out_company_name: this.$store.state.user.severUserInfo.company_name,
        in_company_name: JSON.parse(this.modalStr).sq_name
      }
      createOutApplu(this.modalInfo).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '',
            desc: '迁出人员信息成功'
          })
          this.modal1 = false
          this.getList()
        } else {
          this.$Notice.error({
            title: '迁出人员信息失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    cancel () {
      this.modal1 = false
      this.modal2 = false
      this.modal3 = false
      this.modal4 = false
    },
    perChange (index) {
      let temparea = this.params['area' + index]
      if (!temparea) {
        return
      }
      let templist = this.addressInfo['list' + index]
      let tempdata = {}
      for (let i = 0; i < templist.length; i++) {
        if (temparea === templist[i].company_code) {
          tempdata = templist[i]
        }
      }
      this.getDownAddress(tempdata.id, index + 1)
    },
    // 下拉搜索框的级联查询
    getDownAddress (pid, index) {
      let param = {
        pid: pid,
        pageNo: 1,
        pageSize: 200
      }
      grid_downlist(param).then(res => {
        if (res.data.data) {
          this.addressInfo['list' + index] = res.data.data.results
          let obj = {
            id: '',
            level: '',
            mapjson: '',
            path: '',
            pid: 0,
            title: '全部',
            company_code: ''
          }
          this.addressInfo['list' + index].unshift(obj)
          this.perChange(index)
        } else {
          this.$Notice.error({ title: '查看失败', desc: '查询地址信息失败' })
        }
      })
    },
    getCompanyList () {
      getUserByMZList({}).then(res => {
        if (res.data.errcode === 0) {
          this.company_list = res.data.data
        } else {
          this.$Notice.error({
            title: '获取社区列表失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    uploadImgAll (row, what) {
      this.row = row
      this.$refs.imgService.modelAction()
    },
    pageSizeChange (e) {
      this.params.pageSize = e
      this.selectlist(this.params.pageNo)
    },
    chuanSongAction () {
      this.$refs.turnPeopleModel.modelAction()
    },
    exportData (type) {
      this.loading = true
      this.getAllList()
      // if (this.dataFlag === false) { // 没有数据需加载接口
      //  this.loading = true
      //  this.getAllList()
      // } else {
      //  this.loading = false
      //  this.$refs.table.exportCsv({
      //    filename: '疫情监控人员信息',
      //    columns: this.columns1,
      //    data: this.fcAllDataList.map(item => {
      //      item.arrive_time = '="' + item.arrive_time + '"'
      //      item.create_time = '="' + item.create_time + '"'
      //      if (item.referral === '1') { // 送诊状态
      //        item.referral = '已送诊'
      //      } else {
      //        item.referral = '未送诊'
      //      }
      //      if (item.illness_state === '1') { // 人员状态
      //        item.illness_state = '疑似病例'
      //      } else if (item.illness_state === '2') {
      //        item.illness_state = '确诊病例'
      //      } else if (item.illness_state === '3') {
      //        item.illness_state = '死亡'
      //      } else if (item.illness_state === '4') {
      //        item.illness_state = '治愈'
      //      } else if (item.illness_state === '5') {
      //        item.illness_state = '正常'
      //      }
      //      if (item.isfollow === '1') { // 密切接触
      //        item.isfollow = '是'
      //      } else {
      //        item.isfollow = '否'
      //      }
      //      if (item.inout_state === '1') { // 离沈入沈
      //        item.inout_state = '入沈人员'
      //      } else if (item.inout_state === '2') {
      //        item.inout_state = '离沈人员'
      //      }
      //      if (item.arrive_address_type === '6') {
      //        item.arrive_address_type = '韩国'
      //      } else if (item.arrive_address_type === '7') {
      //        item.arrive_address_type = '日本'
      //      }
      //      // if (item.del_flag === '1') {
      //      //  item.del_flag = '否'
      //      // } else if (item.del_flag === '0') {
      //      //  item.del_flag = '是'
      //      // }
      //      return item
      //    }),
      //    original: false
      //  })
      // }
    },
    importExcel () {

    },
    hideCode (str, frontLen, endLen) {
      var len = str.length - frontLen - endLen
      var xing = ''
      for (var i = 0; i < len; i++) {
        xing += '*'
      }
      return str.substring(0, frontLen) + xing + str.substring(str.length - endLen)
    }
  },
  mounted () {
    this.params.user_type = this.$route.query.user_type
    this.findDictList()
    this.getDownAddress(0, 1)
    this.getCity(null, 'provinceList', false)
    // this.getCompanyList()
  }
}
</script>

<style scoped>
  .page_style {
    margin: 20px 5px;
  }

  .input-frame {
    width: 120px;
    margin-right: 10px;
  }

  .house-list > .group {
    background: white;
    padding: 10px;
    margin-top: 10px;
  }

  .house-list > .group > .item {
    border-bottom: 1px solid #f5f5f5;
    padding: 10px 0;
  }

  .house-list > .group > .item .top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
  }

  .house-list > .group > .item .title {
    font-size: 14px;
    color: #333333;
  }

  .house-list > .group > .item .address {
    font-size: 12px;
    color: gray;
    display: flex;
    align-items: center;
  }

  .house-list > .group > .item .detail {
    font-size: 12px;
    color: dodgerblue;
  }

  .opt-area-02 {
    display: flex;
    align-items: center;
    flex-direction: column;
    border: 1px solid #abdcff;
    background-color: #f0faff;
    padding: 8px 16px 8px 16px;
    border-radius: 4px;
    margin-bottom: 10px;
  }

  .opt-area-02 .right-con {
    width: 100%;
    margin-top: 5px;
    display: flex;
  }

  .opt-area-02 .left-con {
    font-size: 14px;
    width: 100%;
  }

  .opt-area-02 .left-con span {
    font-weight: bold;
  }

  .opt-area-02 .right-con input {
    width: 150px;
    margin-right: 10px;
  }

  .opt-area-02 .right-con .input-frame {
    width: 200px;
    margin-right: 10px;
  }

  .table-action-btn {
    margin-right: 3px;
  }

  .container >>> .ivu-btn-small {
    height: 24px;
    padding: 0 5px;
    font-size: 12px;
    border-radius: 3px;
  }

  .btn-action {
    margin-bottom: 10px;
  }

  .mp10 {
    margin-right: 10px;
  }
  .title-style {
    color: red;
  }
  .mb20 {
    margin-bottom: 20px;
  }
  .ivu-table-row {
    height: 57px;
  }
  .demo-spin-icon-load{
    animation: ani-demo-spin 1s linear infinite;
  }
  @keyframes ani-demo-spin {
    from { transform: rotate(0deg);}
    50%  { transform: rotate(180deg);}
    to   { transform: rotate(360deg);}
  }
  .demo-spin-col{
    height: 100px;
    position: relative;
    /*border: 1px solid #eee;*/
  }
</style>
